﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using StripeOne.Blog.Base.Common;
using StripeOne.Blog.Base;
using StripeOne.Blog.Models;

namespace StripeOne.Blog.Controllers
{
    public class AdminPostsController : StripeOneController
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Add()
        {
            return View("Post", new PostModel());
        } 

        [HttpPost]
        public ActionResult Add(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToRoute("PostsEdit_BLA", new { id = 0 });
            }
            catch
            {
                return View();
            }
        }
        
        public ActionResult Edit(int id)
        {
            return View("Post", new PostModel());
        }

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToRoute("PostsEdit_BLA", new { id = 0 });
            }
            catch
            {
                return View();
            }
        }

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                return RedirectToRoute("PostsIndex_BLA");
            }
            catch
            {
                return View();
            }
        }
    }
}
